var time = "";
//获得当前的时间
function currentTime() {
    var nowDate = new Date();
    var hour = changeNum(nowDate.getHours());
    var miunte = changeNum(nowDate.getMinutes());
    var second = changeNum(nowDate.getSeconds());

    return hour + ":" + miunte + ":" + second;
}
//获得当前的日期
function currentDate() {
    var nowDate = new Date();
    var year = nowDate.getFullYear();
    var month = changeNum(nowDate.getMonth() + 1);
    var date = changeNum(nowDate.getDate());

    // return year + "年" + month + "月" + date + "日";
    return year + "." + month + "." + date;
}

function changeNum(t) {
    return t < 10 ? "0" + t : t;
}
$.fn.showCurrentTime = function() {
    var div = $(this);
    return this.each(function() {
        time = currentTime();
        div.text(time);
        setInterval(function() {
            time = currentTime();
            div.text(time);
        }, 1000);
    });

};
$.fn.showCurrentDate = function() {
    var div = $(this);
    return this.each(function() {
        time = currentDate();
        div.text(time);
    });

};